﻿using Client.Framework.Message;
using Client.Model;
using Google.Protobuf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Client.Message.Request
{
    class AddEditPermissionReq : RequestBaseMessage
    {
        public AddEditPermissionReq(int msgId) : base(msgId)
        {

        }

        public ViewPermisson Permisson { get; set; }

        public override byte[] Serialize()
        {
            AddEditPermission msg = new AddEditPermission();
            if (Permisson != null)
            {
                Permission permission = new Permission
                {
                    Id = Permisson.ID,
                    PerCode = Permisson.PerCode,
                    Status = (int)Permisson.Status,
                    Sort = Permisson.Sort
                };
                msg.Permission = permission;
            }
            return msg.ToByteArray();
        }
    }
}
